<template>
  <div>
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="交货日期">
        <el-date-picker
          v-model="dateRange"
          style="width: 240px"
          value-format="yyyy-MM-dd"
          type="daterange"
          range-separator="-"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :default-time="['00:00:00', '23:59:59']"
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="送货单号" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="送货单号"
          clearable
          style="width: 160px;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="品名" prop="userName">
        <el-input
          v-model="queryParams.userName"
          placeholder="品名"
          clearable
          style="width: 120px;"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="差异原因" prop="status">
        <el-select
          v-model="queryParams.status"
          placeholder="差异原因"
          clearable
          style="width: 160px"
        >
          <el-option
            v-for="dict in resonoption"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="状态" prop="status">
        <el-select
          v-model="queryParams.status"
          placeholder="状态"
          clearable
          style="width: 120px"
        >
          <el-option
            v-for="dict in selectoption"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-unlock"
          size="mini"
          @click="handleSubmits"
        >批量确认
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="primary"
          size="mini"
          @click="handleExport"
        >导出
        </el-button>
      </el-col>
      <el-col :span="1.5" style="font-size: 15px;">
        <span>订单笔数：0</span>
        <span style="margin: 0 10px;">订单金额：0</span>
        <span style="margin: 0 10px;">确认笔数：0</span>
        <span>确认金额：0</span>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <Table
      ref="tableref"
      :tableHeader="tableHeader"
      :selected="{show:true}"
    >
      <template slot="table-operate" slot-scope="scope">
        <el-link @click="handleSubmit(scope.row)" type="primary" style="margin-right: 10px" :underline="false">确认
        </el-link>
        <el-link @click="handledifferent(scope.row)" type="primary" style="margin-right: 10px" :underline="false">有异议
        </el-link>
      </template>
    </Table>


    <el-dialog :title="title" :visible.sync="dialogVisible" :close-on-click-modal="false" width="600px">
      <Complaint ref="Complaint"/>
    </el-dialog>
  </div>
</template>

<script>
import Complaint from './Complaint'
import Table from '@/components/Table'

export default {
  name: 'ConfirmOrderList',
  components: { Complaint, Table },
  data() {
    return {
      dialogVisible: false,
      title: '差异',
      tableHeader: [
        { label: '发货时间', prop: '', fixed: 'left', width: '' },
        { label: '开单时间', prop: '', fixed: 'left', width: '' },
        { label: '网单号码', prop: '', fixed: 'left', width: '' },
        { label: '外部送货单号', prop: '', fixed: 'left', width: '' },
        { label: '交货单号', prop: '', fixed: 'left', width: '' },
        { label: '品名', prop: '', width: '' },
        { label: '客户PO', prop: '', width: '' },
        { label: '门幅', prop: '', width: '' },
        { label: '长', prop: '', width: '' },
        { label: '宽', prop: '', width: '' },
        { label: '坪价', prop: '', width: '' },
        { label: '剖数', prop: '', width: '' },
        { label: '折扣百分率', prop: '', width: '' },
        { label: '交货量', prop: '', width: '' },
        { label: '结算金额', prop: '', width: '' },
        { label: '折后单价', prop: '', width: '' },
        { label: '客户确认(状态)', prop: '', width: '' },
        { label: '差异原因', prop: '', width: '' },
        { label: '客户备注', prop: '', width: '' },
        { label: '更改人', prop: '', width: '' },
        { label: '更改日期', prop: '', width: '' },
        { label: '更改时间', prop: '', width: '' },
        { label: '附加费', prop: '', width: '' }
      ],
      showSearch: true,
      selectoption: [
        {
          label: '已确认',
          value: 1
        },
        {
          label: '未确认',
          value: 2
        }
      ],
      resonoption: [
        {
          label: '数量差',
          value: 1
        },
        {
          label: '坪价差异',
          value: 2
        },
        {
          label: '折扣差异',
          value: 3
        },
        {
          label: '其他',
          value: 4
        }
      ],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10
      },
      dateRange: []
    }
  },
  created() {

  },
  methods: {
    /**
     * 差异
     **/
    handledifferent(row) {
      this.dialogVisible = true
    },
    /**
     * 获取列表
     **/
    getList() {

    },
    /**
     * TODO 提交
     **/
    handleSubmit(row) {

    },
    /**
     * TODO 批量提交
     **/
    handleSubmits() {

    },
    /**
     * TODO 导出
     **/
    handleExport() {

    },

    /**
     * TODO 搜索按钮操作
     * */
    handleQuery() {
      this.queryParams.pageNum = 1
    },
    /**
     * TODO 重置按钮操作
     * */
    resetQuery() {
      this.dateRange = []
      this.queryParams.pageNum = 1
    }

  }
}
</script>

